import { defHttp } from '/@/utils/http/axios';
import { saveWarehouseItem, homeSettingParams } from './model/settingsModel';
enum Api {
  ADMIN_REPOSITORY_SETTINGS = '/api/admin/repositorySettings',
  ADMIN_REPOSITORY_SETTINGS_CHECK_ACCESS = '/api/admin/repositorySettings/checkAccess',
  AUTH_TOKEN = '/api/auth/token',
  SYSTEM_PARAMS = '/api/system/params',
  TENANT_DASHBOARDS = '/api/tenant/dashboards',
  HOME_INFO = '/api/tenant/dashboard/home/info',
  DASHBOARD_INFO = '/api/dashboard/info',
  NOTIFICATION_SETTINGS = '/api/notification/settings',
}
export const getRepositorySettings = () => defHttp.get<any>({ url: Api.ADMIN_REPOSITORY_SETTINGS });

export const getCheckAccessSettings = (data: saveWarehouseItem) =>
  defHttp.post<any>({ url: Api.ADMIN_REPOSITORY_SETTINGS_CHECK_ACCESS, data });

export const editRepositorySettings = (data: saveWarehouseItem) =>
  defHttp.post<any>({ url: Api.ADMIN_REPOSITORY_SETTINGS, data });

export const deleteRepositorySettings = () =>
  defHttp.delete<any>({ url: Api.ADMIN_REPOSITORY_SETTINGS });

export const getSystemParams = () => defHttp.get<any>({ url: Api.SYSTEM_PARAMS });

export const getHomePageSettings = (params: any) =>
  defHttp.get<any>({ url: Api.TENANT_DASHBOARDS, params });

export const getInfoData = () => defHttp.get<any>({ url: Api.HOME_INFO });

export const saveInfoData = (data: any) => defHttp.post<any>({ url: Api.HOME_INFO, data });

export const saveTheHomeSetting = (id: any) =>
  defHttp.get<any>({ url: Api.DASHBOARD_INFO + `/${id}` });

export const getNotificationSettings = () => defHttp.get<any>({ url: Api.NOTIFICATION_SETTINGS });

export const editNotificationSettings = (data: any) =>
  defHttp.post<any>({ url: Api.NOTIFICATION_SETTINGS, data });
